package com.xueyi.aixihu.controller;

import com.xueyi.aixihu.controller.base.BaseController;
import com.xueyi.aixihu.exception.SzException;
import com.xueyi.aixihu.response.base.BaseResponse;
import com.xueyi.aixihu.service.UploadFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author LuQi
 * @类描述 上传文件Controller
 * @时间 2021/11/7
 */
@RestController
public class UploadFileController extends BaseController {

    @Autowired
    UploadFileService uploadFileService;

    /**
     * 上传图片
     * @param file
     * @return
     */
    @RequestMapping("/upload/iv")
    public BaseResponse<String> uploadImageOrVideo(MultipartFile file) throws SzException {

        String ivPath = uploadFileService.uploadImageOrVideo(file);
        return BaseResponse.success(ivPath);
    }
}
